#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org

START=250

parse_device() {
        local cfg="$1" ip download upload

        config_get ip "$cfg" ip
        config_get download "$cfg" download
        config_get upload "$cfg" upload

        eqos add $ip $download $upload
}

eqos_start() {
        local cfg="$1" enabled download upload

        config_get_bool enabled "$cfg" enabled 0
        [ $enabled -eq 0 ] && return 0

        config_get download "$cfg" download
        config_get upload "$cfg" upload

        eqos start $download $upload

        config_foreach parse_device device
}

start() {
        start2 &

#--- starts: Deleted by Wiwiz
#       eqos stop
#
#       config_load eqos
#       config_foreach eqos_start eqos
#---- ends
}

#--- starts: added by Wiwiz
start2() {
        sleep 30
        eqos stop

        config_load eqos
        config_foreach eqos_start eqos
}
#--- ends

stop() {
        eqos stop
}